package progeny;

public class Trait {
	final String type;
	String characteristic = null;
	
	public Trait(){
		this("A");
	}
	
	
	public Trait(String type){
		this(type, true);
	}
	
	public Trait(String type, boolean dominant){
		if (dominant)this.type = type.toUpperCase();
		else this.type = type.toLowerCase();
	}
	
	public String getCharacteristic(){
		if (characteristic!=null)return characteristic;
		return type;
	}
	
	public void setcharacteristic(String characteristic){
		this.characteristic = characteristic;
	}
	
	public void removeCharacteristic(){
		characteristic = null;
	}
	
	public boolean equals(Trait other){
		return this.type.toLowerCase().equals(other.type.toLowerCase());
	}
	
	public int dominantOver(Trait other){
		return type.compareTo(other.type);
	}
	
	public String toString(){
		return type;
	}
}
